<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@include file="/WEB-INF/pages/common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <title><spring:message code="title.part"/></title>
    <script type="text/javascript">
        var datagrid;
        var message =$.messager;
        var operateDialog;
        $(function() {
            datagrid=$('#datagrid').datagrid({
                url : '${path}/basedata/part/ajaxList.do',
                onLoadSuccess:function(){
                    datagrid.datagrid('clearSelections');
                },
                onDblClickRow: function(index,rowData){
                    sure_();
                },
                queryParams: imonJYRH.serializeObject($("#tableForm *"))
            });
        });
        function search_() {
            datagrid.datagrid('unselectAll');
            datagrid.datagrid('load', imonJYRH.serializeObject($("#tableForm *")));
        }
        function reset_(){
            $("#tableForm *").each(function(){
                $(":input:not(:checkbox,:radio)",this).val("");
            });
        }
        function sure_(){
            var row = datagrid.datagrid("getSelected");
            if(row){
                parent.dialogPartReturn(row);
            }else{
                message.alert('<spring:message code='msg.tip'/>','<spring:message code='msg.please.choose'/>');
            }
        }
    </script>
</head>
<body class="easyui-layout">
<div data-options="region:'north'" style="overflow: hidden;height: 35px;">
    <div class="datagrid-toolbar" style="height: auto">
        <table id="tableForm" width="100%">
            <tr>
                <td align="right"><spring:message code='label.part.code'/>：</td>
                <td>
                    <input type="hidden" name="supplierId" value="${supplierId}"/>
                    <input type="text" name="code"/>
                </td>
                <td align="right"><spring:message code='label.part.name'/>：</td>
                <td>
                    <input type="text" name="name"/>
                </td>
            </tr>
        </table>
    </div>
</div>
<div data-options="region:'center'">
    <div id="tb">
        <a class="easyui-linkbutton" href="javascript:void(0);" plain="true" iconCls="icon-ok" onclick="sure_();"><spring:message code='button.sure'/></a>
        <a class="easyui-linkbutton" href="javascript:void(0);" plain="true" iconCls="icon-search" onclick="search_();"><spring:message code="bar.command.search"/></a>
        <a class="easyui-linkbutton" href="javascript:void(0);" plain="true" iconCls="icon-undo" onclick="reset_();"><spring:message code="bar.command.reset"/></a>
    </div>
    <table id="datagrid" width="100%"
           data-options="toolbar:'#tb',striped:true,fit:true,pagination:true,idField:'id',rownumbers:true,singleSelect:true">
        <thead>
        <tr>
            <th data-options="checkbox:'true',field:'ck'"></th>
            <th data-options="align:'center',width:'100',field:'code'"><spring:message code="table.head.part.code"/></th>
            <th data-options="align:'center',width:'100',field:'name'"><spring:message code="table.head.part.name"/></th>
            <th data-options="align:'center',width:'100',field:'drawingCode'"><spring:message code="table.head.part.drawing.code"/></th>
            <th data-options="align:'center',width:'100',field:'drawingVersionCode'"><spring:message code="table.head.part.drawing.version.code"/></th>
            <th data-options="align:'center',width:'100',field:'customerName'"><spring:message code="table.head.part.customer.name"/></th>
            <th data-options="align:'center',width:'100',field:'customerProjectCode'"><spring:message code="table.head.part.customer.project.code"/></th>
            <th data-options="align:'center',width:'100',field:'carModel'"><spring:message code="table.head.part.car.model"/></th>
        </tr>
        </thead>
    </table>
</div>
<div id="operateDialog" class="easyui-dialog"
     data-options="iconCls:'icon-save',resizable:true,modal:true,closed: true,collapsible:true,maximizable:true">
    <iframe scrolling="auto" id='operateIFrame' frameborder="0"  src="" style="width:100%;height:100%;"/>
</div>
</body>
</html>